package com.jc.service.util;

import com.google.common.base.Splitter;

import java.lang.reflect.Field;
import java.util.List;

/**
 * @author wangli
 * @create 2016-08-28 15:23
 * @description
 */

public class GeneratorDomainMethod {


    public static void main(String[] args) {

//        generator(new OrderDetailBo());
    }

    public static void generator(Object object) {
//        Person person = new Person();

//        Class personClass = person.getClass();
//        Field[] fields = person.getClass().getDeclaredFields();

        Class personClass = object.getClass();
        Field[] fields = object.getClass().getDeclaredFields();

        for (Field field : fields) {

            List<String> name = Splitter.on(".").splitToList(personClass.getName());
            List<String> type =Splitter.on(".").splitToList(field.getType().toString());


            System.out.println("public " + name.get(name.size() - 1) + " " +field.getName() + "(" + type.get(type.size() - 1)+ " value"+")" + " {");
            System.out.println("this." + field.getName() + " = value" + ";");
            System.out.println("return this;");
            System.out.println("}");

        }
    }
}
